<style>
    .trong-content{
	width: 505px;
	margin: auto;
    }
    .content{
	border: none;
    }
</style>
<div class="container content">
    <div class="trong-content">

	<div class="center">

	    <div class="box update-account-box">

		<form action="" method="get">
		    <div class="search-pro">
			<div class="title">Search Profile</div>
			<table cellpadding="0" cellspacing="0" class="table table-bordered table-pro">

			    <?php
			    /*			     * ******************age************************* */
			    ?>
			    <tr>
				<td>Age</td>
				<td>
				    From: 
				    <select name="User[ageFrom]" class="select-ideal-profile select-in-search" style="vertical-align: middle">
					<?php
					foreach (User::getListAge() as $key => $value) {
					    if (isset($_GET['User']['ageFrom']) && $_GET['User']['ageFrom'] == $key) {
						echo "<option value='" . $key . "' selected>" . $value . "</option>";
					    } else {
						echo "<option value='" . $key . "'>" . $value . "</option>";
					    }
					}
					?>
				    </select>

				    To: 
				    <select name="User[ageTo]" class="select-ideal-profile select-in-search">
					<?php
					foreach (User::getListAge() as $key => $value) {
					    if (isset($_GET['User']['ageTo']) && $_GET['User']['ageTo'] == $key) {
						echo "<option value='" . $key . "' selected>" . $value . "</option>";
					    } else {
						echo "<option value='" . $key . "'>" . $value . "</option>";
					    }
					}
					?>
				    </select>
				</td>
			    </tr>
			    <?php
			    /*			     * ******************Height************************* */
			    ?>
			    <tr>
				<td>Height</td>
				<td>
				    From: 
				    <select name="User[heightFrom]" class="select-ideal-profile select-in-search" style="vertical-align: middle">
					<?php
					foreach (User::getListHeight() as $key => $value) {
					    if (isset($_GET['User']['heightFrom']) && $_GET['User']['heightFrom'] == $key) {

						echo "<option value='" . $key . "' selected>" . $value . "</option>";
					    } else {

						echo "<option value='" . $key . "'>" . $value . "</option>";
					    }
					}
					?>
				    </select>

				    To: 
				    <select name="User[heightTo]" class="select-ideal-profile select-in-search">
					<?php
					foreach (User::getListHeight() as $key => $value) {
					    if (isset($_GET['User']['heightTo']) && $_GET['User']['heightTo'] == $key) {
						echo "<option value='" . $key . "' selected>" . $value . "</option>";
					    } else {
						echo "<option value='" . $key . "'>" . $value . "</option>";
					    }
					}
					?>
				    </select>
				</td>
			    </tr>

			    <tr>
				<td>Location:</td>
				<td><input type="text" placeholder="Zip Code" name="User[postcode]" value="<?php if (isset($_GET['User']['postcode']) && $_GET['User']['postcode']) echo $_GET['User']['postcode']; ?>"/></td>
			    </tr>	
			    <tr>
				<td colspan="2"><a href="javascript:void(0)" class="btn btn-primary" id="advance-search">Advance searching</a></td>
			    </tr>
			</table>
			<div id="box-advance-search" style="display:none">
			    <table cellpadding="0" cellspacing="0" class="table table-bordered table-pro">
				<?php
				/*				 * ******************Marital************************* */
				?>
				<tr>
				    <td>Marital:</td>
				    <td>
					<table class="more-information">
					    <?php
					    $i = 0;
					    foreach (User::getListMarital() as $key => $value) {
						$i++;
						if ($i == 1) {
						    ?>
						    <tr>
							<?php
						    }
						    ?>
    						<td>
    						    <div class="wrap-checkbox-search">
    							<input <?php if (isset($_GET['User']['marital']) && $_GET['User']['marital'] == $key) echo 'checked' ?> type="radio" value="<?php echo $key ?>" name="User[marital]"/><?php echo $value; ?>
    						    </div>
    						</td>
						    <?php
						    if ($i == 3) {
							$i = 0;
							?>
						    </tr>
						    <?php
						}
					    }
					    ?>
					</table>
				    </td>
				</tr>

				<tr>
				    <td>Ethnicity</td>
				    <td>
					<table class="more-information">
					    <?php
					    $i = 0;
					    foreach (User::getListEthnicity() as $key => $value) {
						$i++;
						if ($i == 1) {
						    ?>
						    <tr>
							<?php
						    }
						    ?>
    						<td>
    						    <div class="wrap-checkbox-search">
    							<input <?php if (isset($_GET['User']['ethnicity']) && $_GET['User']['ethnicity'] == $key) echo 'checked' ?> type="radio" value="<?php echo $key ?>" name="User[ethnicity]"/><?php echo $value; ?>
    						    </div>
    						</td>
						    <?php
						    if ($i == 3) {
							$i = 0;
							?>
						    </tr>
						    <?php
						}
					    }
					    ?>
					</table>
				    </td>
				</tr>

				<tr>
				    <td>Relationship</td>
				    <td>
					<table class="more-information">
					    <?php
					    $i = 0;
					    foreach (User::getListRelationship() as $key => $value) {
						$i++;
						if ($i == 1) {
						    ?>
						    <tr>
							<?php
						    }
						    ?>
    						<td>
    						    <div class="wrap-checkbox-search">
    							<input <?php if (isset($_GET['User']['relationship']) && $_GET['User']['relationship'] == $key) echo 'checked' ?> type="radio" value="<?php echo $key ?>" name="User[relationship]"/><?php echo $value; ?>
    						    </div>
    						</td>
						    <?php
						    if ($i == 3) {
							$i = 0;
							?>
						    </tr>
						    <?php
						}
					    }
					    ?>
					</table>
				    </td>
				</tr>

				<tr>
				    <td>Zodiac</td>
				    <td>
					<table class="more-information">
					    <?php
					    $i = 0;
					    foreach (User::getListZodiac() as $key => $value) {
						$i++;
						if ($i == 1) {
						    ?>
						    <tr>
							<?php
						    }
						    ?>
    						<td>
    						    <div class="wrap-checkbox-search">
    							<input <?php if (isset($_GET['User']['zodiac']) && $_GET['User']['zodiac'] == $key) echo 'checked' ?> type="radio" value="<?php echo $key ?>" name="User[zodiac]"/><?php echo $value; ?>
    						    </div>
    						</td>
						    <?php
						    if ($i == 4) {
							$i = 0;
							?>
						    </tr>
						    <?php
						}
					    }
					    ?>
					</table>
				    </td>
				</tr>

				<tr>
				    <td>Smoking Preference</td>
				    <td>
					<table class="more-information">
					    <?php
					    $i = 0;
					    foreach (User::getListSmoking() as $key => $value) {
						$i++;
						if ($i == 1) {
						    ?>
						    <tr>
							<?php
						    }
						    ?>
    						<td>
    						    <div class="wrap-checkbox-search">
    							<input <?php if (isset($_GET['User']['smoking']) && $_GET['User']['smoking'] == $key) echo 'checked' ?> type="radio" value="<?php echo $key ?>" name="User[smoking]"/><?php echo $value; ?>
    						    </div>
    						</td>
						    <?php
						    if ($i == 4) {
							$i = 0;
							?>
						    </tr>
						    <?php
						}
					    }
					    ?>
					</table>
				    </td>
				</tr>

				<tr>
				    <td>General Build</td>
				    <td>
					<table class="more-information">
					    <?php
					    $i = 0;
					    foreach (User::getListBuild() as $key => $value) {
						$i++;
						if ($i == 1) {
						    ?>
						    <tr>
							<?php
						    }
						    ?>
    						<td>
    						    <div class="wrap-checkbox-search">
    							<input <?php if (isset($_GET['User']['build']) && $_GET['User']['build'] == $key) echo 'checked' ?> type="radio" value="<?php echo $key ?>" name="User[build]"/><?php echo $value; ?>
    						    </div>
    						</td>
						    <?php
						    if ($i == 3) {
							$i = 0;
							?>
						    </tr>
						    <?php
						}
					    }
					    ?>
					</table>
				    </td>
				</tr>

				<tr>
				    <td>Children</td>
				    <td>
					<table class="more-information">
					    <?php
					    $i = 0;
					    foreach (User::getListChildren() as $key => $value) {
						$i++;
						if ($i == 1) {
						    ?>
						    <tr>
							<?php
						    }
						    ?>
    						<td>
    						    <div class="wrap-checkbox-search">
    							<input type="radio" value="<?php echo $key ?>" <?php if (isset($_GET['User']['children']) && $_GET['User']['children'] == $key) echo 'checked' ?> name="User[children]"/><?php echo $value; ?>
    						    </div>
    						</td>
						    <?php
						    if ($i == 1) {
							$i = 0;
							?>
						    </tr>
						    <?php
						}
					    }
					    ?>
					</table>
				    </td>
				</tr>


				<tr>
				    <td>Religion</td>
				    <td>
					<table class="more-information">
					    <?php
					    $i = 0;
					    foreach (User::getListReligion() as $key => $value) {
						$i++;
						if ($i == 1) {
						    ?>
						    <tr>
							<?php
						    }
						    ?>
    						<td>
    						    <div class="wrap-checkbox-search">
    							<input type="radio" value="<?php echo $key ?>" <?php if (isset($_GET['User']['religion']) && $_GET['User']['religion'] == $key) echo 'checked' ?> name="User[religion]"/><?php echo $value; ?>
    						    </div>
    						</td>
						    <?php
						    if ($i == 4) {
							$i = 0;
							?>
						    </tr>
						    <?php
						}
					    }
					    ?>
					</table>
				    </td>
				</tr>							    

			    </table>
			</div>
			<input type="submit" name="search" value="Search" class="btn btn-primary btn-search"/>
		    </div>

		</form>
		<div class="bottom-box1"></div>
		<?php if (isset($model)) { ?>
    		<div class="title">Results</div>


    		<div class="spot-inner">
    		    <ul>
			    <?php foreach ($aUsers as $user) { ?>
				<li>
				    <div class="img-inner">
					<img src="<?php echo $user->getAvatarUrl(); ?>">
				    </div>
				    <div class="text-inner">
					<h3><a href="<?php echo url('facebook_app/view_user') . '/id/' . $user->user_id; ?>"><?php echo $user->username; ?></a></h3>
					Age: <?php echo $user->age ?><br />
					<strong>A little about me:</strong>  <?php echo h($user->more_info[1], 125); ?>
					<?php /*
					  <br/>
					  <a class="btn btn-small" href="profile.php"><i class="icon-ok"></i> View Full Profile</a>
					 * 
					 */ ?>
				    </div>
				</li>
			    <?php } ?>
    		    </ul>
    		</div>
    		<div class="bottom-box1"></div>
    		<!-- ************************************** START PAGINATOR *************************************-->
    		<div class="pagination pagination-1 user-paginator">
			<?php
			$this->widget('bootstrap.widgets.TbPager', array(
			    'pages' => $pages
			))
			?>
    		    <div class='total-record'>
			    <?php
			    if ($iTotalRecord > User::TOTAL_RECORD) {
				$array = getPageination($pages);
				?>
				Showing <?php echo $array['start']; ?>-<?php echo $array['end']; ?> of <?php echo $iTotalRecord; ?>    		    
			    <?php } ?>
    		    </div>
    		</div>
    		<!-- ************************************** END PAGINATOR *************************************-->
		<?php } ?>
	    </div><!--box-->

	</div><!--center-->

    </div><!--trong-content-->


</div><!--content-->
